﻿<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.io.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>svn同步程序</title>
</head>
<body>
<span style="color:blue">SVN同步更新状态：</span><br>
<%
	try
	{
		out.println("<br> <span style='font-size:12px;'> 之间网ubetween开发同步:</span><br>");
		//exec message
		String message = "";
		String line = "";

		String execShell = "svn up svn://192.168.1.61/ubcode /data/website/ubcode/ --username admin --password admin";

		//exec local process
		Process process = Runtime.getRuntime().exec (execShell);

		//get the inputStream and the contents
		InputStreamReader ir=new InputStreamReader(process.getInputStream());
		LineNumberReader input = new LineNumberReader (ir);		
		while ((line = input.readLine ()) != null){
			message = message + line;
		}

		//print the messages
		if(message == null || message.equals(""))
		{
			out.println("<span style='color:red'> svn has something wrong,please check the svn server.tips:maybe the server is shutdown!</span>");
		}
		else
		{
			try {
				out.println(" success:<span style='color:green'>"+java.net.URLDecoder.decode(message,"utf-8")+"</span><br/>svn up svn://192.168.1.61/ubcode /data/website/ubcode/");
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}

	}catch (java.io.IOException e){
		System.err.println ("IOException " + e.getMessage());
		out.print(" error:"+e);
	}
	catch(Exception e)
	{
		out.print(" error:"+e);
	}
%>
</body>
</html>
